package sdfi.lee.Entity.base;

import java.io.Serializable;


/**
 * This is an object that contains data related to the news table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="news"
 */

public abstract class BaseNews  implements Serializable {

	public static String REF = "News";
	public static String PROP_NEWSDATE = "newsdate";
	public static String PROP_NEWSTYPE = "newstype";
	public static String PROP_ID = "id";
	public static String PROP_NEWSTITLE = "newstitle";
	public static String PROP_NEWSCONTENT = "newscontent";


	// constructors
	public BaseNews () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseNews (java.lang.Integer id) {
		this.setId(id);
		initialize();
	}

	/**
	 * Constructor for required fields
	 */
	public BaseNews (
		java.lang.Integer id,
		java.lang.String newstitle,
		java.lang.Integer newstype) {

		this.setId(id);
		this.setNewstitle(newstitle);
		this.setNewstype(newstype);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String newstitle;
	private java.lang.Integer newstype;
	private java.util.Date newsdate;
	private java.lang.String newscontent;

	// collections
	private java.util.Set<sdfi.lee.Entity.Newspic> newspics;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="identity"
     *  column="Id"
     */
	public java.lang.Integer getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: newstitle
	 */
	public java.lang.String getNewstitle () {
		return newstitle;
	}

	/**
	 * Set the value related to the column: newstitle
	 * @param newstitle the newstitle value
	 */
	public void setNewstitle (java.lang.String newstitle) {
		this.newstitle = newstitle;
	}



	/**
	 * Return the value associated with the column: newstype
	 */
	public java.lang.Integer getNewstype () {
		return newstype;
	}

	/**
	 * Set the value related to the column: newstype
	 * @param newstype the newstype value
	 */
	public void setNewstype (java.lang.Integer newstype) {
		this.newstype = newstype;
	}



	/**
	 * Return the value associated with the column: newsdate
	 */
	public java.util.Date getNewsdate () {
		return newsdate;
	}

	/**
	 * Set the value related to the column: newsdate
	 * @param newsdate the newsdate value
	 */
	public void setNewsdate (java.util.Date newsdate) {
		this.newsdate = newsdate;
	}



	/**
	 * Return the value associated with the column: newscontent
	 */
	public java.lang.String getNewscontent () {
		return newscontent;
	}

	/**
	 * Set the value related to the column: newscontent
	 * @param newscontent the newscontent value
	 */
	public void setNewscontent (java.lang.String newscontent) {
		this.newscontent = newscontent;
	}



	/**
	 * Return the value associated with the column: newspics
	 */
	public java.util.Set<sdfi.lee.Entity.Newspic> getNewspics () {
		return newspics;
	}

	/**
	 * Set the value related to the column: newspics
	 * @param newspics the newspics value
	 */
	public void setNewspics (java.util.Set<sdfi.lee.Entity.Newspic> newspics) {
		this.newspics = newspics;
	}

	public void addTonewspics (sdfi.lee.Entity.Newspic newspic) {
		if (null == getNewspics()) setNewspics(new java.util.TreeSet<sdfi.lee.Entity.Newspic>());
		getNewspics().add(newspic);
	}




	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof sdfi.lee.Entity.News)) return false;
		else {
			sdfi.lee.Entity.News news = (sdfi.lee.Entity.News) obj;
			if (null == this.getId() || null == news.getId()) return false;
			else return (this.getId().equals(news.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}